/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.edu.just.firstjavaapp.l15;


import cn.edu.just.firstjavaapp.Student;
import cn.edu.just.firstjavaapp.l7.Person;

import java.io.*;

/**
 *
 * @author Administrator
 */
public class DataStreamWriteTest01 {
    static final String dataFile = "c:/java/test01";
    public static void main(String[] args) throws FileNotFoundException, IOException{
        int a = 10;
        double price = 12.34;
        String desc = "T-shirt";
        Person person = new Person("张三",20,"1",3.14);
        ObjectOutputStream out = null;
        
        try {
            out = new ObjectOutputStream(new  BufferedOutputStream(new FileOutputStream(dataFile)));  //wrapper
            out.writeDouble(price);                  
            out.writeInt(a); 
            out.writeUTF(desc);
            out.writeObject(person);
            
        } finally {
            out.close();
        }
        
    }
    
    public static void method1(){
        
    }
}
